package com.dgt.trade.domain;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by hxq on 2017/5/10.
 */
public class Page<T> implements Serializable{
    private static final long serialVersionUID = 1L;

    public static final String PAGESIZE = "pageSize";
    public static final String CURRENT_PAGE = "currentPage";
    public static final String TOTAL = "total";
    public static final String PAGER_VAR = "pager";
    private int pageSize;
    private int currentPage;
    private int totalPages;
    private long total;
    private List<T> modelDatas;

    private List<Map<String, Object>> data;

    private List<ActionLog> actionLogs;

    public List<T> getModelDatas() {
        return modelDatas;
    }

    public void setModelDatas(List<T> modelDatas) {
        this.modelDatas = modelDatas;
    }

    
    public List<ActionLog> getActionLogs() {
		return actionLogs;
	}

	public void setActionLogs(List<ActionLog> actionLogs) {
		this.actionLogs = actionLogs;
	}

	public List<Map<String, Object>> getData() {
        return data;
    }

    public void setData(List<Map<String, Object>> data) {
        this.data = data;
    }

    public int getCurrentPage() {
        return this.currentPage;
    }

    public int getCalculateTotalPages() {
        if(this.total % this.pageSize == 0) {
            this.totalPages = (int)this.total / this.pageSize;
        } else {
            this.totalPages = (int)this.total / this.pageSize + 1;
        }
        return this.totalPages;
    }


    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getStart() {
        return this.pageSize * (this.currentPage > 0?this.currentPage - 1:0);
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }
}
